using System.Collections.Generic;
using UnityEngine;

namespace Framework
{
    public class World
    {
        Dictionary<Vector3Int, Chunk> chunks = new Dictionary<Vector3Int, Chunk>();
        public Chunk this[Vector3Int index]
        {
            get
            {
                if (chunks.ContainsKey(index))
                {
                    return chunks[index];
                }
                else
                {
                    var chunk = WorldGenerator.CreatChunk(index);
                    chunks.Add(index, chunk);
                    return chunk;
                }
            }
            set
            {
                if (chunks.ContainsKey(index))
                {
                    chunks[index] = value;
                }
                else
                {
                    chunks.Add(index, value);
                }
            }
        }

    }

}